package org.tong.seata;

import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.tong.bean.Score;
import org.tong.bean.Student;
import org.tong.dao.ScoreDao;
import org.tong.dao.StudentDao;

@Service
public class SeataService {
    @Autowired
    private StudentDao studentDao;

    @Autowired
    private ScoreDao scoreDao;

    @GlobalTransactional
    public void insert(Student student, Score score) {
        studentDao.insert(student);
        scoreDao.insert(score);
    }
}
